package com.juben.svr.domain.Enum;

import com.juben.svr.domain.ApiResponse;
import okhttp3.*;
import org.springframework.http.ResponseEntity;

import java.io.IOException;
import java.util.Objects;

public class Aritcle_review {
    static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();    // 创建OkHttpClient实例, 用于发送请求
    public  Object shenhe(String args) throws IOException {
        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");   // 设置请求头
        RequestBody body = RequestBody.create(mediaType, "text="+args);    // 设置请求体, 包含文章id、评论内容、评论分数
        Request request = new Request.Builder()
<<<<<<< HEAD
                .url("https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined?access_token=24.13575662c64c0c6bace045c04d0b6eab.2592000.1733647312.282335-115697442")
=======
                .url("https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined?access_token=24.68e6621acad76f99398a01aa379651a4.2592000.1729847931.282335-115697442")
>>>>>>> 38a1dbe3941ebf5713fbf4c6d3dbf69154c425d3
                .method("POST", body)
                .addHeader("Content-Type", "application/json")
                .build();
        Response response = HTTP_CLIENT.newCall(request).execute();
        //System.out.println(Objects.requireNonNull(response.body()).string());

        Object data = response.body().string();

        return data;
    }
}
